package pl.edu.agh.hollonCommision.graph.metrics;

import java.util.Map;

import pl.edu.agh.hollonCommision.graph.GraphModel;
import pl.edu.agh.hollonCommision.graph.Vertex;

public abstract class IGraphMetric {

	public abstract void calculateMetric(GraphModel g);
	protected void normalizeMetric(GraphModel g, String metricName){
		Map<Integer, Vertex> vertices = g.getVertices();
		double maxMetric = 0;
		for(Vertex v: vertices.values()){
			maxMetric =  Math.max(maxMetric, v.getMetricValue(metricName));
		}
		for(Vertex v: vertices.values()){
			v.setCurrentMetricNormalizedValue(v.getMetricValue(metricName)/maxMetric);
		}
	}
}
